﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Arles.src.view.controls
{
    public partial class TackBarControl : UserControl
    {
        public delegate void TrackBarArgs(int value);
        public event TrackBarArgs ValueChanged;

        #region Properties
        public int Value
        {
            get { return trackBar.Value; }
            set 
            { 
                trackBar.Value = value; 
            }
        }

        public int Minimum
        {
            set {trackBar.Minimum = value;}
        }

        public int Maximum
        {
            set { trackBar.Maximum = value; }
        }

        public int TickFrequency
        {
            set { trackBar.TickFrequency = value; }
        }

        public float Div { get; set; }
        #endregion

        public TackBarControl()
        {
            InitializeComponent();
        }

        private void trackBar_ValueChanged(object sender, EventArgs e)
        {
            tbValue.Text = (trackBar.Value / Div).ToString();
            ValueChanged.Invoke(trackBar.Value);
        }
    }
}
